package com.hontech.bv.utils;

public final class Sync {

    private boolean flag = false;

    public synchronized void signal() {
        flag = true;
        notify();
    }

    public void reset() {
        flag = false;
    }

    public synchronized boolean await(long timeout) throws InterruptedException {
        if (!flag) {
            wait(timeout);
        }
        boolean v = flag;
        flag = false;
        return v;
    }
}
